home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / lang_ext / vbawk / multigre.usr < prev    next >
Encoding:
Text File  |  1994-08-12  |  1.7 KB  |  56 lines

  1. Global SearchStr(100) As String
  2. Global RepStr(100) As String
  3. Global NumStrings As Integer
  4. Dim Replacements As Long
  5. Dim TotalReplacements As Long
  6. Global CaseSensitivity As Integer
  7.  
  8.  
  9. 'This routine is called after each file is closed and
  10. 'all processing for that file is finished.
  11. Sub AfterAFile ()
  12.     WriteToStatus Replacements & " substitutions made."
  13.     TotalReplacements = TotalReplacements + Replacements
  14. End Sub
  15.  
  16. 'This routine is called at the very end of the program,
  17. 'after all files have been processed.
  18. Sub AfterAllFiles ()
  19.     WriteToStatus "TOTAL # OF SUBSTITUTIONS: " & TotalReplacements
  20. End Sub
  21.  
  22. 'The return value of BeforeAFile is usually True, which
  23. 'indicates that the current file is to be processed
  24. 'normally.  By returning False, you can skip processing
  25. 'the current file.
  26. Function BeforeAFile ()
  27.     Replacements = 0
  28.     BeforeAFile = True
  29. End Function
  30.  
  31. 'This routine is executed at the very beginning of the
  32. 'application, before any files are opened or any
  33. 'processing has taken place.
  34. Function BeforeAllFiles () As Integer
  35.     APPNAME = "Multi-Grep"
  36.     MultiGrep.Show 1
  37.     If MultiGrep.Tag = "Cancel" Then
  38.         BeforeAllFiles = False
  39.     Else
  40.         BeforeAllFiles = True
  41.     End If
  42. End Function
  43.  
  44. 'This routine called over and over, each time being
  45. 'passed a succeeding line of the file being
  46. 'processed.  Or, in binary mode, this routine is passed
  47. 'a chunk of bytes as long as RECLEN, except for the
  48. 'final chunk which may be smaller than RECLEN.
  49. Function DoALine (TheLine As String) As Integer
  50.     For i% = 0 To NumStrings - 1
  51.         Replacements = Replacements + gsub(TheLine, SearchStr(i%), RepStr(i%))
  52.     Next i%
  53.     DoALine = True
  54. End Function
  55.  
  56.